<template>

  <main class="site-content mybg">
    <div style="margin: 0 auto;width: 1200px;">
      <div style="display: flex;align-items: center;justify-content: space-between;color: #fff;margin-bottom: 10px">
        <div style="font-size: 14px">
          <span>欢迎您访问固安县政协网</span>
          <span style="margin: 0 5px">今天是{{ nowDate }}</span>
          <span>{{ currentWeekDay }}</span>
        </div>
        <el-input
          style="width: 280px"
          placeholder="请输入内容"
          prefix-icon="el-icon-search"
          v-model="title">
          <el-button slot="append" @click="searchContenList()">搜索</el-button>
        </el-input>
      </div>
      <!-- 主入口标签页 e -->
      <div style="background-color: #fff;padding: 10px 20px;min-height: 500px">
        <keep-alive>
          <router-view :key="$route.fullPath"/>
        </keep-alive>
      </div>
    </div>
  </main>


</template>

<script>
export default {
  inject: ['refresh'],
  data() {
    return {
      title: '',
      nowDate: '',
      currentWeekDay: '',
    }
  },
  created() {
    this.getNowDate()
  },
  methods: {
    getNowDate() {
      let date = new Date()
      this.nowDate = date.getFullYear() + "年" + (date.getMonth() + 1) + "月" + (date.getDate() + 1) + "日"
      const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
      const today = new Date().getDay();
      this.currentWeekDay = weekDays[today];
    },
    searchContenList(){
      window.open(this.$router.resolve({'name': 'search', 'query': {'title': this.title}}).href, '_blank');
    }
  }
}
</script>
<style scoped>
.mybg {
  background-image: url(~@/assets/img/bg.png); /* 替换为你的图片路径 */
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  height: 100%;
}
</style>

